package com.lanou.demo.backgrounddemo.service.impl;

import com.lanou.demo.backgrounddemo.mapper.ItemParamMapper;
import com.lanou.demo.backgrounddemo.service.ItemParamService;
import com.lanou.entity.entity.ItemParamEntity;
import com.lanou.entity.utils.IdsResultUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by 常宏盛
 * Date: 2019/7/12 8:57
 **/
@Service
public class ItemParamServiceImpl implements ItemParamService {

    @Resource
    private ItemParamMapper itemParamMapper;

    @Override
    public int count() {
        return this.itemParamMapper.count();
    }

    @Override
    public List<ItemParamEntity> list(int page, int rows) {
        int offset = (page - 1) * rows;
        return itemParamMapper.list(offset, rows);
    }

    @Override
    public ItemParamEntity queryParamDataByCid(Long id) {
        return this.itemParamMapper.queryParamDataByCid(id);
    }

    @Override
    public int save(Long cid, String paramData) {
        return this.itemParamMapper.save(cid, paramData);
    }

    @Override
    public int delete(String[] ids) {
        List<Long> deleteIdsList = IdsResultUtils.idsResultList(ids);
        return this.itemParamMapper.delete(deleteIdsList);
    }

}
